package ro.ubb.web.author;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ro.ubb.dataaccess.entities.Author;
import ro.ubb.executor.Executor;

public class SaveAuthor extends HttpServlet {

	@EJB(name = "ro.ubb.executor.Executor", beanName = "ExecutorEJB")
	private Executor executor;
	
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		//super.doPut(req, resp);
		
		String name = req.getParameter("name");
		
		Author author = new Author();
		author.setName(name);
		executor.saveAuthor(author);
	}
}
